//
// Created by 吴喆 on 2020/3/5.
//

#ifndef SUMMER_GAMEOBJECT_H
#define SUMMER_GAMEOBJECT_H

#import <box2d/box2d.h>
#import <glm/glm.hpp>
#import "Renderer.h"

class Scene;
enum class OBJECT_TYPE {
    N, FLOOR, PLAYER, NPC, BULLET, UI
};
/**
 * character direction
 */
enum class DIRECTION {
    UP, DOWN, LEFT, RIGHT
};

class GameObject {

public:
    explicit GameObject(const Scene *scene_) : scene(scene_) {}

    virtual ~GameObject() = default;

    // 逻辑更新
    virtual void update() = 0;

    // 渲染调用
    virtual void render() = 0;

    // 初始化gameObject
    virtual void initGameObject();

    // 初始化renderer
    virtual void initRenderer();

    OBJECT_TYPE objectType = OBJECT_TYPE::N;

    Renderer *renderer = nullptr;

    // gameObject所在场景
    const Scene *scene;

    // 物体起始位置
    glm::vec2 initPosition;
    // 物体当前位置
    glm::vec2 currPosition;
    // 物体中心位置
    glm::vec2 currCenterPosition;
    // 物体尺寸
    glm::vec2 size;

    /**
     * direction of {@code Playable}
     */
    DIRECTION direction = DIRECTION::RIGHT;

};


#endif //SUMMER_GAMEOBJECT_H
